<?php

use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;

class CreateSystemTaskTable extends Migration
{
    /**
     * Run the migrations.
     */
    public function up(): void
    {
        Schema::create('system_task', function (Blueprint $table) {
            $table->bigInteger('id', true);
            $table->integer('menu_check_id')->default(0)->comment('审核菜单id,不同角色拥有的审核权限不同');
            $table->string('system_task_type', 255)->nullable();
            $table->string('name', 255)->nullable();
            $table->string('form_key', 255)->nullable();
            $table->bigInteger('sender_id')->nullable()->index('sender_id_idx');
            $table->string('sender_name', 255)->nullable();
            $table->dateTime('deadline', 6)->nullable();
            $table->string('comment', 255)->nullable();
            $table->bigInteger('activity_instance_id')->nullable();
            $table->bigInteger('assignee_id')->nullable()->index('assignee_id_idx');
            $table->string('assignee_name', 255)->nullable();
            $table->dateTime('assign_time', 6)->nullable();
            $table->text('extend_data')->nullable();
            $table->integer('result')->nullable()->comment('0未完成，1已完成');
            $table->dateTime('finish_time', 6)->nullable();
            $table->bigInteger('flow_instance_id')->nullable();
            $table->bigInteger('form_instance_id')->nullable()->index('form_instance_id_idx');
            $table->timestamp('created_at')->nullable()->useCurrent();
            $table->timestamp('updated_at')->useCurrentOnUpdate()->nullable()->useCurrent();
            $table->bigInteger('creator_id')->nullable();
            $table->bigInteger('updater_id')->nullable();
        });
    }

    /**
     * Reverse the migrations.
     */
    public function down(): void
    {
        Schema::dropIfExists('system_task');
    }
};
